function PidFind()

{

    PIDCOUNT=`ps -ef | grep $1 | grep -v "grep" | grep -v $0 | awk '{print $2}' | wc -l`;

    if [ ${PIDCOUNT} -gt 1 ] ; then

        echo "There are too many process contains name[$1]"

    elif [ ${PIDCOUNT} -le 0 ] ; then

        echo "No such process[$1]!"

    else

        PID=`ps -ef | grep $1 | grep -v "grep" | grep -v ".sh" | awk '{print $2}'` ;

        echo "Find the PID of this progress!--- process:$1 PID=[${PID}] ";

echo "Kill the process $1 ...";

        kill -9  ${PID};

        echo "kill -9 ${PID} $1 done!";

    fi

}
PidFind zhangl
nohup java -Xms100m -Xmx512m -jar zhangl-0.0.1-SNAPSHOT.jar &
echo $! > zhangl.pid
exit 1
